<?php
// include function files for this application
require_once('/home/domains/uny-con.com/public_html/uny-con_fns.php');
if (!session_id()) { session_start(); }

if (!check_valid_user()) {
	do_html_header('Co-GM Results', gobig, $uny);
	echo 'You are not logged in, please login with the registration tab above';
	print_brs(6);
	do_html_footer(no_news);
	exit;
	}

//get some variables
	$event_id = $_GET['event_id'];
	$start_time = $_GET['start_time'];
	$duration = $_GET['duration'];
	$action = $_GET['action'];


if (!empty($event_id) && !empty($start_time)) {
	if ($action == 'add' && (!check_attendee_timeslot_reg($_SESSION['current_attendee_id'], $start_time, $duration) || $_SESSION['admin'] == 't')) {
		add_gm($_SESSION['current_attendee_id'], $event_id, $start_time);
		header("Location: ".$conf['base_path']."registration/attendee_home.php");
		exit;
		} 
	if ($action == 'delete') {
		delete_gm($_SESSION['current_attendee_id'], $event_id, $start_time);
		header("Location: ".$conf['base_path']."registration/attendee_home.php");
		exit;
		}
	}
if (check_attendee_timeslot_reg($_SESSION['current_attendee_id'], $start_time, $duration) == 't') {
	do_html_header('Co-GM Results', staysmall, $uny);
	echo 'You appear to already be playing or gming something in this timeslot.';
	print_brs(6);
	do_html_footer(news);
	exit;
	}